import request from '@/utils/request'

export function getAllGoodsInfo () {
  return request({
    url: '/selectAllConditionSheet',
    method: 'get'
  })
}

export function checkGoodsDetail (commodityId: string) {
  return request({
    url: '/getConditionSheetCommodity',
    method: 'post',
    params: {
      commodityId
    }
  })
}

export function checkUserName (commodityId: string) {
  return request({
    url: 'getUserNicknameByCommodityId',
    method: 'post',
    params: {
      commodityId
    }
  })
}

export function checkUserDes (commodityId: string) {
  return request({
    url: 'getUserDescriptionByCommodityId',
    method: 'post',
    params: {
      commodityId
    }
  })
}

export function checkUserId (commodityId: string) {
  return request({
    url: 'getUserIdByCommodityId',
    method: 'post',
    params: {
      commodityId
    }
  })
}

export function updatePV (commodityId: string) {
  return request({
    url: 'insertConditionSheetOperationData',
    method: 'post',
    params: {
      commodityId
    }
  })
}

export function selectConditionSheetOperationData (commodityId: string){
  return request({
    url: 'selectConditionSheetOperationData',
    method: 'post',
    params: {
      commodityId
    }
  })
}

export function getConditionSheetsWhereOnStateIsOne () {
  return request({
    url: 'getConditionSheetsWhereOnStateIsOne',
    method: 'get'
  })
}

export function auditSuccess (conditionSheetId: string, commodityName: string, commodityDescription: string, commodityPrice: number) {
  return request({
    url: 'auditSuccess',
    method: 'post',
    params: {
      conditionSheetId,
      commodityName,
      commodityDescription,
      commodityPrice
    }
  })
}

export function auditFail (conditionSheetId: string) {
  return request({
    url: 'auditFail',
    method: 'post',
    params: {
      conditionSheetId
    }
  })
}
